<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui" template="../layout/template.xhtml">
	<ui:define name="content">
		<f:view>
			<f:facet name="header">
			#{bookHeaven.authorContent}
		</f:facet>

			<h:form id="addAuthorForm">
				<h:panelGrid columns="2">
					<h:panelGroup>
						<h:panelGrid columns="2">

							<h:outputLabel value="#{bookHeaven.title} :" />
							<h:inputText value="#{authorBean.entity.authorTitle}"
								required="true" />
							<h:outputLabel value="#{bookHeaven.name} :" />
							<h:inputText value="#{authorBean.entity.authorName}"
								required="true" />
							<h:outputLabel value="#{bookHeaven.surname} :" />
							<h:inputText value="#{authorBean.entity.authorSurname}"
								required="true" />
							<h:outputLabel value="#{bookHeaven.birthDay} :" />
							<p:calendar value="#{authorBean.entity.authorBirthDate}"
								locale="tr" showButtonPanel="true" navigator="true" id="trCal" />
						</h:panelGrid>
					</h:panelGroup>
					<h:panelGroup>
						<h:panelGrid columns="2">
							<h:outputLabel value="#{bookHeaven.about} :" />
							<h:inputTextarea rows="3"
								value="#{authorBean.entity.authorAbout}" />
							<h:outputLabel value="#{bookHeaven.link} :" />
							<h:inputText value="#{authorBean.entity.authorLink}" />
						</h:panelGrid>
					</h:panelGroup>
				</h:panelGrid>
				<h:panelGroup>
					<p:commandButton value="Save" ajax="false"
						action="#{authorBean.saveEntity()}" />
					<p:commandButton value="NextPage" ajax="true" update="authorListform"
						action="#{authorBean.getNextPage()}" />
				</h:panelGroup>
			</h:form>
			<h:form id="authorListform">

				<p:dataTable var="author" value="#{authorBean.entityList}">
					<f:facet name="header">  
            			#{bookHeaven.authors}
        			</f:facet>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bookHeaven.title}" />
						</f:facet>
						<h:outputText value="#{author.authorTitle}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bookHeaven.name}" />
						</f:facet>
						<h:outputText value="#{author.authorName}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bookHeaven.surname}" />
						</f:facet>
						<h:outputText value="#{author.authorSurname}" />
					</p:column>

					<p:column>
						<f:facet name="header">
							<h:outputText value="#{bookHeaven.link}" />
						</f:facet>
						<h:commandLink action="#{author.authorLink}" />
					</p:column>
				</p:dataTable>
			</h:form>
		</f:view>
	</ui:define>
</ui:composition>
